<template>
	<div>
		<el-table
			border
			size="mini"
			:data="tableData"
			style="margin-bottom:20px;"
			:header-cell-style="getRowClass"
		>
			<el-table-column
				align="center"
				:label="`${$t('report.project')}`"
				prop="settlementCode"
				min-width="130"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						getTypeName(
							scope.row.settlementCode,
							commissionSettlementName
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="$t('funds.fund_audit.team_commission')"
				prop="commissionAmount"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(
							scope.row.currency,
							scope.row.commissionAmount
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="`${$t('funds.fund_audit.team_commission_rate')}`"
				prop="commissionRate"
				min-width="120"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{ handlePercentage(scope.row.commissionRate) }}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="`${$t('funds.fund_audit.rectification_net_losses')}`"
				prop="rushAmount"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{ handleNumber(scope.row.currency, scope.row.rushAmount) }}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="`${$t('funds.fund_audit.previous_period_balance')}`"
				prop="commissionLastAmount"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(
							scope.row.currency,
							scope.row.commissionLastAmount
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="`${$t('funds.fund_audit.total_pure_amount')}`"
				prop="proxyNetwinAmount"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(
							scope.row.currency,
							scope.row.proxyNetwinAmount
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="$t('report.member_return_water')"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(
							scope.row.currency,
							scope.row.memberRebateAmount
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				min-width="120"
				:label="$t('funds.fund_audit.member_rebate_other_adjust')"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(
							scope.row.currency,
							scope.row.memberRebateAddAmount -
								scope.row.memberRebateSubAmount
						)
					}}
				</template>
			</el-table-column>
			<el-table-column
				prop="venueAmount"
				align="center"
				min-width="120"
				:label="$t('funds.fund_audit.venue_cost')"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(scope.row.currency, scope.row.venueAmount)
					}}
				</template>
			</el-table-column>
			<el-table-column
				prop="platformNetAmount"
				align="center"
				min-width="120"
				:label="platformNetAmountTitle"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					<div
						v-if="isTexas"
						class="blueColor decoration"
						style="cursor: pointer;"
						@click="showDetails"
					>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.serviceAmountContribution
							)
						}}
					</div>
					<template v-else>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.platformNetAmount
							)
						}}
					</template>
				</template>
			</el-table-column>
		</el-table>
		<ServiceChargeDetail
			from="commission"
			module="funds"
			:dialog="dialog"
			kind="team"
			:tableData="tableData"
			:handleClose="handleClose"
		/>
	</div>
</template>

<script>
import list from '@/mixins/list'
import { commissionSettlementName } from '@/dict/funds'
import ServiceChargeDetail from '@/components/Dialog/ServiceChargeDetail'
export default {
	mixins: [list],
	components: {
		ServiceChargeDetail
	},
	props: {
		isTexas: {
			type: Boolean,
			default: false
		},
		tableData: {
			type: Array,
			default: () => {}
		}
	},
	data() {
		return {
			dialog: false,
			commissionSettlementName
		}
	},
	computed: {
		platformNetAmountTitle() {
			if (this.isTexas) {
				return this.$t('common.service_charge_contribute_team')
			} else {
				return '总会员盈亏'
			}
		}
	},
	methods: {
		showDetails() {
			this.dialog = true
		},
		handleClose() {
			this.dialog = false
		}
	}
}
</script>
